package com.numbfish.ch01_ex06_event;

import com.numbfish.ch01_ex06_event.config.CustomConfig;
import com.numbfish.ch01_ex06_event.event.MethodExecutionEventPublisher;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

@SpringBootTest
@Slf4j

public class Ch01Ex06EventTestApp {
    @Autowired
    private  ApplicationContext applicationContext;




    @Test
    void contextLoads() {
        log.info("applicationContext = {}",applicationContext);
    }
    @Test
    void beanCount(){
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(CustomConfig.class);
        MethodExecutionEventPublisher publisher = context.getBean(MethodExecutionEventPublisher.class);
        publisher.methodToMonitor();
    }



}